package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AppraisalMapper;
import com.ruoyi.system.domain.Appraisal;
import com.ruoyi.system.service.IAppraisalService;

/**
 * 考核申请Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-11-13
 */
@Service
public class AppraisalServiceImpl implements IAppraisalService 
{
    @Autowired
    private AppraisalMapper appraisalMapper;

    /**
     * 查询考核申请
     * 
     * @param id 考核申请主键
     * @return 考核申请
     */
    @Override
    public Appraisal selectAppraisalById(Long id)
    {
        return appraisalMapper.selectAppraisalById(id);
    }

    /**
     * 查询考核申请列表
     * 
     * @param appraisal 考核申请
     * @return 考核申请
     */
    @Override
    public List<Appraisal> selectAppraisalList(Appraisal appraisal)
    {
        return appraisalMapper.selectAppraisalList(appraisal);
    }

    /**
     * 新增考核申请
     * 
     * @param appraisal 考核申请
     * @return 结果
     */
    @Override
    public int insertAppraisal(Appraisal appraisal)
    {
        appraisal.setCreateTime(DateUtils.getNowDate());
        appraisal.setUserId(SecurityUtils.getUserId());
        appraisal.setUserName(SecurityUtils.getUsername());
        return appraisalMapper.insertAppraisal(appraisal);
    }

    /**
     * 修改考核申请
     * 
     * @param appraisal 考核申请
     * @return 结果
     */
    @Override
    public int updateAppraisal(Appraisal appraisal)
    {
        appraisal.setUpdateTime(DateUtils.getNowDate());
        return appraisalMapper.updateAppraisal(appraisal);
    }

    /**
     * 批量删除考核申请
     * 
     * @param ids 需要删除的考核申请主键
     * @return 结果
     */
    @Override
    public int deleteAppraisalByIds(Long[] ids)
    {
        return appraisalMapper.deleteAppraisalByIds(ids);
    }

    /**
     * 删除考核申请信息
     * 
     * @param id 考核申请主键
     * @return 结果
     */
    @Override
    public int deleteAppraisalById(Long id)
    {
        return appraisalMapper.deleteAppraisalById(id);
    }
}
